﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using Lib.Data;
using Lib.Helper;

/// <summary>
/// Summary description for dm_dt
/// </summary>
public class dm_dt
{
    public static DataTable FDM_NAM_LKE()
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        return DataSql.GetData(_nsd.nsd, "PDT_NAM_LKE");
    }
    public static string FDM_NAM_NH(double ma, string ten)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        object[] val = DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma, ten }, "@ID", "PDT_NAM_NH");
        return val[0].ToString();
    }
    public static void FDM_NAM_XOA(double ma)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma }, "PDT_NAM_XOA");
    }
    //HE DT
    public static DataTable FDT_HE_DT_LKE()
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        double bac_id = Lib.Utilities.LibConvert.ObjectToDouble(System.Web.HttpContext.Current.Session["bacdt"]);
        double htdt_id = Lib.Utilities.LibConvert.ObjectToDouble(System.Web.HttpContext.Current.Session["hedt"]);
        double nganh_id = Lib.Utilities.LibConvert.ObjectToDouble(System.Web.HttpContext.Current.Session["nganhdt"]);
        return DataSql.GetData(new object[] { _nsd.nsd, bac_id, htdt_id, nganh_id }, "PDT_HT_DT_LKE");
    }
    public static string FDT_HE_DT_NH(double ma, string ten)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        double bac_id = Lib.Utilities.LibConvert.ObjectToDouble(System.Web.HttpContext.Current.Session["bacdt"]);
        double htdt_id = Lib.Utilities.LibConvert.ObjectToDouble(System.Web.HttpContext.Current.Session["hedt"]);
        double nganh_id = Lib.Utilities.LibConvert.ObjectToDouble(System.Web.HttpContext.Current.Session["nganhdt"]);
        object[] val = DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma, ten, bac_id, htdt_id, nganh_id }, "@ID", "PDT_HT_DT_NH");
        return val[0].ToString();
    }
    public static void FDT_HE_DT_XOA(double ma)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma }, "PDT_HT_DT_XOA");
    }

    //DM LOẠI KIỂM TRA
    public static DataTable FDT_LOAI_KIEMTRA_LKE()
    {
        return DataSql.GetData("PDT_LOAI_KTRA_LKE");
    }

    //khoa
    public static DataTable FDT_KHOA_LKE(string ht_dt)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        return DataSql.GetData(new object[] { _nsd.nsd, ht_dt }, "PDT_KHOA_LKE");
    }
    public static string FDT_KHOA_NH(double ht_dt, double ma, string ten, string gchu)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        object[] val = DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ht_dt, ma, ten, gchu }, "@ID", "PDT_KHOA_NH");
        return val[0].ToString();
    }
    public static void FDT_KHOA_XOA(double ma)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma }, "PDT_KHOA_XOA");
    }

    //BOMNO
    public static DataTable FDT_BO_MON_LKE()
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        return DataSql.GetData(_nsd.nsd, "PDT_BO_MON_LKE");
    }
    public static string FDT_BO_MON_NH(double ma, string ten)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        object[] val = DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma, ten }, "@ID", "PDT_BO_MON_NH");
        return val[0].ToString();
    }
    public static void FDT_BO_MON_XOA(double ma)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma }, "PDT_BO_MON_XOA");
    }
    //BOMNO
    public static DataTable FDT_MON_LKE(double bomon_id)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        return DataSql.GetData(new object[] { _nsd.nsd, bomon_id }, "PDT_MON_LKE");
    }
    public static string FDT_MON_NH(double ma, double bm_id, string ten)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        object[] val = DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma, bm_id, ten }, "@ID", "PDT_MON_NH");
        return val[0].ToString();
    }
    public static void FDT_MON_XOA(double ma)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma }, "PDT_MON_XOA");
    }

    //LOP HOC
    public static DataTable FDT_LOP_LKE(double khoaid)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        return DataSql.GetData(new object[] { _nsd.nsd, khoaid }, "PDT_LOP_LKE");
    }
    public static string FDT_LOP_NH(double ma, double khoa_id, string ten, string nam_dt)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        object[] val = DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma, khoa_id, ten, nam_dt }, "@ID", "PDT_LOP_NH");
        return val[0].ToString();
    }
    public static void FDT_LOP_XOA(double ma)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ma }, "PDT_LOP_XOA");
    }
    //GIANG UONG
    public static DataTable FDT_GIANG_DUONG_LKE()
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        return DataSql.GetData(_nsd.nsd, "PDT_GIANG_DUONG_LKE");
    }


    // PC_GIANGDAY
    public static DataTable FDT_PC_GIANGDAY_LKE(double nam, string hk, double lop)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        return DataSql.GetData(new object[] { _nsd.nsd, nam, hk, lop }, "PDT_PC_GIANGDAY_LKE");
    }
    public static void FDT_PC_GIANGDAY_NH(DataTable b_dt_nh)
    {
        DataSql.ExeCuteProcedure(b_dt_nh, "PDT_PC_GIANGDAY_NH");
    }
    public static void FDT_PC_GIANGDAY_XOA(double ns_id, string hk, double nam, double lop, double mon)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, ns_id, hk, nam, lop, mon }, "PDT_PC_GIANGDAY_XOA");
    }

    //TKB
    public static DataTable FDT_TKB_LKE(double nam, string hk, double lop)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        return DataSql.GetData(new object[] { _nsd.nsd, nam, hk, lop }, "PDT_TKB_LKE");
    }
    public static void FDT_TKB_NH(DataTable b_dt_nh)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataSql.ExeCuteProcedure(b_dt_nh, "PDT_TKB_NH");
    }
    public static void FDT_TKB_XOA(string thu, double lop, double ns_id, double nam_id, string hk, double mon, double gd_id)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, thu, lop, ns_id, nam_id, hk, mon, gd_id }, "PDT_TKB_XOA");
    }

    public static DataTable FDT_LOP_PC_DAY_LKE(double nam_id)
    {
        DataTable b_dt = Lib.Data.DataSql.GetData(nam_id, "PDT_TKB_LOP");
        return b_dt;
    }
    //ĐK học
    public static void FDT_TKB_DKY_HOC(double nam, double lop, string hk)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, nam, lop, hk }, "PDT_TKB_DANG_KY_HOC");
    }

    //Điểm
    public static DataTable FDT_DIEM_TIM(double lop, double mon_id, double nam, string hk, double loai_kt, string b_loai)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        return DataSql.GetData(new object[] { lop, mon_id, _nsd.id_nsd, nam, hk, loai_kt, b_loai }, "PDT_DIEM_LKE");
    }
    public static DataTable FDT_PC_DAY_LOP_LKE(double nam_id, string hk)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataTable b_dt = Lib.Data.DataSql.GetData(new object[] { _nsd.id_nsd, nam_id, hk }, "PDT_PC_LKE_LOP");
        return b_dt;
    }
    public static DataTable FDT_PC_DIEM_LOP_LKE(double nam_id, string hk_id)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataTable b_dt = Lib.Data.DataSql.GetData(new object[] { _nsd.id_nsd, nam_id, hk_id }, "PPC_NHAP_DIEM_LKE");
        return b_dt;
    }
    public static DataTable FDT_PC_NHAP_DIEM_LOP_LKE(double nam_id, string hk_id)
    {
        SessionHelper _nsd = SessionHelper.GetSessionUser();
        DataTable b_dt = Lib.Data.DataSql.GetData(new object[] { _nsd.id_nsd, nam_id, hk_id }, "PPC_NHAP_DIEM_LKE");
        return b_dt;
    }
    //lke khóa sổ
    public static DataTable FDT_KHOA_SO_LKE(double nam, string hk)
    {
        return DataSql.GetData(new object[] { nam, hk }, "PDT_KHOA_SO_LKE");
    }

    //MÔN TỐT NGHIỆP
    public static DataTable FDT_MON_TN(double nam)
    {
        DataTable b_dt = new DataTable();
        return Lib.Data.DataSql.GetData(nam, "PDT_NAM_TN_LKE");
    }
    public static void F_MON_TN_NH(double nam_id, double he_dt, double mon, int hso)
    {
        SessionHelper _nsd = new SessionHelper();
        DataSql.ExeCuteProcedure(new object[] { _nsd.nsd, nam_id, he_dt, mon, hso }, "PDT_MON_TN_NH");
    }
    public static void F_MON_TN_XOA(double nam_id, double mon_id)
    {
        DataSql.ExeCuteProcedure(new object[] { nam_id, mon_id }, "PDT_MON_TN_XOA");
    }

    //Lke lớp văn hoa trong năm đẻ phân công giảng dậy
    public static DataTable Fdt_LOP_VH_LKE(double b_nam_id)
    {
        return DataSql.GetData(b_nam_id, "PDT_LOP_VH_LKE_QTDT");
    }
    //ĐĂNG KÝ 
    public static DataTable Fdt_DK_HOC_LKE(double nam_id, string hk_id)
    {
         SessionHelper _nsd = SessionHelper.GetSessionUser();
         return DataSql.GetData(new object[] { _nsd.nsd, nam_id, hk_id }, "PDT_DKY_HOC_LKE");
    }
}